package ch.zbw.timeline.service;

import java.util.Calendar;
import java.util.List;

import ch.zbw.timeline.domain.Period;
import ch.zbw.timeline.domain.YearConfig;

/**
 * Interface that handles the yearConfigs The yearConfigs are generated and
 * saved to the database The yearConfig can be read from the database
 * 
 * @author Marco
 * 
 */
public interface YearConfigService {

	/**
	 * Method to create a new yearConfig. A new yearConfig is created with the
	 * given parameters and is saved to the database
	 * 
	 * @param year
	 *            the year that is created
	 * @param periodLength
	 *            the period-length that should be activated in the yearConfig
	 * @param weeklyWorkingHours
	 *            the hours of work that have to be worked per week
	 * @param flexitimePercent
	 *            the flexitime in percent that is responsible to handle the
	 *            overtime
	 * @param numberOfVacationDay
	 *            the number of vacation days that every employee with a 100%
	 *            employment-status has
	 * @param easterSunday
	 *            the date of the easter Sunday
	 * @return returns the generated yearConfig
	 */
	public YearConfig createYearConfig(int year, int periodLength, double weeklyWorkingHours, double flexitimePercent,
			int numberOfVacationDay, Calendar easterSunday);

	/**
	 * Method to save and update a yearConfig to the database The given
	 * yearConfig is saved to the database
	 * 
	 * @param yearConfig
	 *            the given yearConfig that has to be updated or saved
	 * @return returns the updated yearConfig
	 */
	public YearConfig saveYearConfig(YearConfig yearConfig);

	/**
	 * Method to get all yearConfig that have been saved to the database so far
	 * 
	 * @return returns a list of yearConfig
	 */
	public List<YearConfig> getAllYearConfigs();

	/**
	 * Method to check if in the year are already checked in any dailyPresences
	 * 
	 * @param yearId
	 *            the id of the year that should be checked
	 * @return returns true if year is already in use
	 */
	public boolean isYearUsed(int yearId);

	/**
	 * Method to get all period that have been saved to the database
	 * 
	 * @param yearConfig
	 *            the given yearConfig that should be checked
	 * @return returns a list of all periods
	 */
	public List<Period> getAllPeriodsByYearConfig(YearConfig yearConfig);

	/**
	 * Method to get all period that have been saved to the database
	 * 
	 * @param year
	 *            the given year that should be checked
	 * @return returns a list of all periods
	 */
	public List<Period> getAllPeriodsByYear(int year);

}
